package com.biboheart.sc.parser;

import com.biboheart.sc.ast.Program;
import com.biboheart.sc.lexer.Lexer;
import com.biboheart.sc.support.definition.Precedence;
import com.biboheart.sc.support.definition.TokenType;
import com.biboheart.sc.token.Token;
import lombok.RequiredArgsConstructor;

@RequiredArgsConstructor
public class ParserDefault implements Parser {
    private final Lexer lexer;
    private Token curr;
    private Token peek;

    @Override
    public Program parse() {
        return null;
    }

    @Override
    public void nextToken() {

    }

    @Override
    public boolean currToken(TokenType type) {
        return curr.getType().equals(type);
    }

    @Override
    public boolean peekToken(TokenType type) {
        return peek.getType().equals(type);
    }

    @Override
    public boolean expectPeekToken(TokenType type) {
        if (peekToken(type)) {
            nextToken();
            return true;
        } else {
            return false;
        }
    }

    @Override
    public int currPrecedence() {
        return Precedence.getPrecedence(curr.getType());
    }

    @Override
    public int peekPrecedence() {
        return Precedence.getPrecedence(peek.getType());
    }
}
